#ifndef __SCNS_TOUCH_SCREEN_H__
#define __SCNS_TOUCH_SCREEN_H__

#include "ScnsConfig.h"

#if defined(SCNS_TOUCH_SCREEN_ENABLE)&&SCNS_TOUCH_SCREEN_ENABLE==1

#include "ScnsBspTouchScreen.h"

#include "ScnsYing.h"
#include "ScnsKey.h"

typedef struct
{
    Point p;
}ScnsTouchScreenSource;

typedef enum
{
    SCNS_TOUCH_SCREEN_BUTTON_RECTANGLE,
    SCNS_TOUCH_SCREEN_BUTTON_CIRCLE,
    
}ScnsTouchScreenButtonShape;

typedef struct
{
    ScnsTouchScreenButtonShape shape;
    union
    {
        struct
        {
            Point plu;
            int16 w,h;
        }rectangle;
        struct
        {
            Point plu;
            int16 r;
        }circle;
    }shapeData;
    ScnsKeyEnum key;
}ScnsTouchScreenButton;

typedef enum
{
    SCNS_TOUCH_SCREEN_STATUS_OK=SCNS_YING_STATUS_OK,
    SCNS_TOUCH_SCREEN_STATUS_BSP_FAILED=SCNS_YING_STATUS_BSP_FAILED,
    SCNS_TOUCH_SCREEN_STATUS_FAILED=SCNS_YING_STATUS_FAILED,
}ScnsTouchScreenStatus;

extern ScnsTouchScreenStatus scnsTouchScreenInit(void);
extern void scnsTouchScreenUpdate(ScnsTouchScreenSource source);
extern void scnsTouchScreenScan(void);
extern ScnsTouchScreenButtonId scnsTouchScreenAddButton(const ScnsTouchScreenButton*button);
extern ScnsTouchScreenButtonId scnsTouchScreenGetButtonId(const ScnsTouchScreenButton*button);
extern void scnsTouchScreenRemoveButton(ScnsTouchScreenButtonId id);
extern void scnsTouchScreenClean(void);
#define scnsTouchScreenIsButtonIdAvailable(id)  (((ScnsTouchScreenButtonId)-1)!=(id))
#if defined(SCNS_LCD_ENABLE)&&SCNS_LCD_ENABLE==1

#include "ScnsLcd.h"

extern void scnsTouchScreenDisplayButtonAll(ScnsLcdLayer layN);
extern void scnsTouchScreenDisplayButton(ScnsLcdLayer layN,const ScnsTouchScreenButton*button,ScnsLcdColor color);
#endif

#endif
#endif
